@echo off
chcp 65001 >nul
echo ========================================
echo    MySQL远程连接测试工具
echo ========================================
echo.

echo 📋 连接信息:
echo    主机: 192.168.1.11
echo    端口: 3306
echo    用户名: remote_user
echo    密码: remote_password123
echo    数据库: community_service_platform
echo.

echo 🔍 正在测试本地连接...
mysql -u remote_user -p -h localhost community_service_platform -e "SELECT '本地连接测试成功' as status;" 2>nul
if %errorlevel% equ 0 (
    echo ✅ 本地连接测试成功
) else (
    echo ❌ 本地连接测试失败
)
echo.

echo 🔍 正在测试远程连接...
mysql -u remote_user -p -h 192.168.1.11 community_service_platform -e "SELECT '远程连接测试成功' as status;" 2>nul
if %errorlevel% equ 0 (
    echo ✅ 远程连接测试成功
) else (
    echo ❌ 远程连接测试失败
)
echo.

echo 📊 数据库信息:
mysql -u remote_user -p -h 192.168.1.11 community_service_platform -e "
SHOW TABLES;
SELECT COUNT(*) as total_tables FROM information_schema.tables WHERE table_schema = 'community_service_platform';
" 2>nul

echo.
echo ========================================
echo    测试完成！
echo ========================================
echo.
echo 💡 组员可以使用以下信息连接:
echo    主机: 192.168.1.11
echo    端口: 3306
echo    用户名: remote_user
echo    密码: remote_password123
echo    数据库: community_service_platform
echo.
echo 🔗 连接命令:
echo    mysql -h 192.168.1.11 -P 3306 -u remote_user -p community_service_platform
echo.
pause
